<script setup lang="ts">

const router = useRouter();

const username = ref('');
const password = ref('');

const loginForm = ref({
  username: '',
  password: '',
});

const handleLogin = () => {
  // 这里可以添加登录逻辑，比如调用API验证用户名和密码


  // 假设登录成功，跳转到首页
  router.push('/');
};
</script>

<template>
  <div class="login-container">
    <h2>登录</h2>
    <el-form :model="loginForm" label-width="80px">
      <el-form-item label="用户名" prop="username">
        <el-input v-model="loginForm.username" placeholder="请输入用户名"></el-input>
      </el-form-item>
      <el-form-item label="密码" prop="password">
        <el-input v-model="loginForm.password" type="password" placeholder="请输入密码"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="handleLogin">登录</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<style scoped lang="scss">
.login-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 20px;
  border: 1px solid #ddd;
  border-radius: 4px;
  margin-top: 50px;
}
</style>